



<extend name="Public/base"/>



<block name="body">




    <form name="myform" id="myform" action="" method="post" class="form-horizontal J_ajaxForm">

        <div class="tab-content ">


            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>标题 </label>
                <div class="col-sm-10">
                    <input type="text"  name="title" value="{$data.title}" class="col-xs-8 col-sm-5 " />
                </div>
            </div>



            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>规格 </label>
                <div class="col-sm-10">
                    <input type="text"  name="guige" value="{$data.guige}" class="input-large  " />


                    计算单价的数量
                    <input type="text"  name="danjia_num" value="{$data.danjia_num}" class="input-small" />

                    /
                    <input type="text"  name="danwei" value="{$data.danwei}" class="input-mini" placeholder="单位" />


                </div>
            </div>



            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>规格分类 </label>
                <div class="col-sm-10">
                    <input type="text"  name="guige_cat" value="{$data.guige_cat}" class="input-large " />
                </div>
            </div>





            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>商品名称(发货使用) </label>
                <div class="col-sm-10">
                    <input type="text"  name="d_title" value="{$data.d_title}" class="col-xs-8 col-sm-5 " />
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-2 control-label "> 属性 </label>
                <div class="col-sm-10">
                    <label><input type="checkbox" name="top" value="1"

                        <if condition="$data[top]"> checked="checked"</if>
                        >  置顶</label>
                    <label><input type="checkbox" name="tui" value="1"  <if condition="$data[tui]"> checked="checked"</if>> 精品推荐</label>
                    <label><input type="checkbox" name="new" value="1"  <if condition="$data['new']"> checked="checked"</if>>  新品上架</label>
                </div>
            </div>




            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>封面 </label>
                <div class="col-sm-10">
                    <att model="product"  action="img"  field="thumb" value="data[thumb]"/>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label "> 附加图片 </label>
                <div class="col-sm-10">
                    <att model="product"  action="img"   field="thumbs" value="data[thumbs]"/>
                </div>
            </div>


            <div class="form-group ">

                <label class="col-sm-2 control-label "> <span class="red">*</span>销量 </label>
                <div class="col-sm-4">
                    <input type="text"  name="xiaoliang" value="{$data.xiaoliang}" class="input-mini" />
                </div>

            </div>


            <div class="form-group ">

                <label class="col-sm-2 control-label "> <span class="red">*</span>库存 </label>
                <div class="col-sm-4">
                    <if condition="$edit">
                        <input type="text"  name="kucun" value="{$data.kucun}" class="input-mini" />
                        <else/>
                        <input type="text"  name="kucun" value="1" class="input-mini" />
                        </if>

                </div>

            </div>

            <div class="form-group ">

                <label class="col-sm-2 control-label "> <span class="red">*</span>原价 </label>
                <div class="col-sm-4">
                    ¥  <input type="text"  name="y_price" value="{$data.y_price}" class="input-small" />

                </div>

            </div>



            <div class="form-group ">

                <label class="col-sm-2 control-label "> <span class="red">*</span>会员价格 </label>
                <div class="col-sm-4">
                    ¥  <input type="text"  name="price" value="{$data.price}" class="input-small" />



                </div>

            </div>

            <div class="form-group ">

                <label class="col-sm-2 control-label "> <span class="red">*</span>钱包支付价格 </label>
                <div class="col-sm-4">
                    <input type="text"  name="qb_price" value="{$data.qb_price}" class="input-small" />
                    ¥
                </div>

            </div>



            <div class="form-group">
                <label class="col-sm-2 control-label "> 关键词 </label>
                <div class="col-sm-10">
                    <input type='text' name='keyword'  value='{$data.keyword}' style='width:400px'   class='input' placeholder='请输入关键字'>
                    <span class="info">    多关键词之间用空格隔开</span>
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>摘要 </label>
                <div class="col-sm-10">
                    <textarea name='desc'  style="width:600px">{$data.desc}</textarea>
                </div>
            </div>


            <div class="form-group">
                <label class="col-sm-2 control-label "> <span class="red">*</span>详情 </label>
                <div class="col-sm-10">
                    <ueditor name="content"  width="750" height="400">{$data.content}</ueditor>
                </div>
            </div>






        </div>






        <if condition="$edit">
            <input type="hidden"  name="id"   value="{$data.id}"  /></if>



        <div class="form-actions">
            <button class="btn btn-info ajax-post"   target-form="J_ajaxForm" type="submit">  <if condition="$edit">更新<else/>提交</if></button>

            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>




    </form>
</block>
<block name="plugin-script">
    <script src="__JS__/content.js"></script>
    <script src="__JS__/ueditor/ueditor.config.js"></script>
    <script src="__JS__/ueditor/ueditor.all.min.js"></script>

    <script>

       $(function(){


           var num=0;

           $("#product_cat_add").click( function(){


               var color=$("#color").val();



               var chicun=$("#chicun").val();
               var chicun_name=$("#chicun").find("option:selected").text();
               var waikuang=$("#waikuang").val();
               var waikuang_name=$("#waikuang").find("option:selected").text();
               var price=$("#price").val();
               var kucun=$("#kucun").val();

               if( color == ''){

                   $("#color").focus();
                   return false;

               }
               if(chicun == ''){

                   $("#chicun").focus();
                   return false;

               }

               if(waikuang == ''){

                   $("#waikuang").focus();
                   return false;

               }

               if(price<=0){

                   $("#price").focus();
                   return false;

               }


               if(kucun<=0){

                   $("#kucun").focus();

                   return false;

               }







               num++;

               html=  $("#cs_list tbody").html();
               html+="<tr id='tr_"+num+"'>" +
                       "<td>"+color+"</td>" +
                       "<td>"+chicun_name+"</td>" +
                       "<td>"+waikuang_name+"</td>" +
                       "<td>￥"+price+"</td>" +
                       "<td>"+kucun+"" +
                       "<input type='hidden' name='cs_list["+num+"][color]' value='"+color+"'>" +
                       "<input type='hidden' name='cs_list["+num+"][chicun]' value='"+chicun+"'>" +
                       "<input type='hidden' name='cs_list["+num+"][waikuang]' value='"+waikuang+"'>" +
                       "<input type='hidden' name='cs_list["+num+"][price]' value='"+price+"'>" +
                       "<input type='hidden' name='cs_list["+num+"][kucun]' value='"+kucun+"'>" +
                       "</td>" +
                       "<td><button class='btn btn-info btn-xs list_remove' ><i class='icon-remove'></i></button></td>" +
                       "</tr>";

               $("#cs_list tbody").html(html);














               return false;
           })

           $(document).on("click",".list_remove",function(){

               $(this).parent().parent().remove(); return false;

           })





       })

    </script>


</block>